<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>编辑文章 - 回声网络</title>
    <style>
        .container { width: 800px; margin: 50px auto; }
        .form-group { margin: 20px 0; }
        label { display: block; margin-bottom: 8px; font-weight: bold; }
        input, textarea { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 4px; }
        textarea { height: 300px; resize: vertical; }
        .btn-submit { background: #007bff; color: white; border: none; padding: 12px 20px; cursor: pointer; }
        .btn-submit:hover { background: #0056b3; }
        .error-msg { color: red; margin: 10px 0; }
        .btn-back { background: #6c757d; color: white; border: none; padding: 12px 20px; cursor: pointer; margin-right: 10px; text-decoration: none; display: inline-block; }
        .btn-back:hover { background: #5a6268; }
    </style>
</head>
<body>
<div class="container">
    <h1>编辑文章</h1>
    <div class="error-msg" th:text="${errorMsg}"></div>
    
    <!-- 编辑模式表单 -->
    <form action="/echo-network/article-edit" method="post">
        <input type="hidden" name="id" th:value="${article != null ? article.id : articleId}">
        <div class="form-group">
            <label for="title">文章标题</label>
            <input type="text" id="title" name="title" required placeholder="请输入标题（不超过100字）" maxlength="100" 
                   th:value="${article != null ? article.title : ''}">
        </div>
        <div class="form-group">
            <label for="content">文章内容（支持Markdown）</label>
            <textarea id="content" name="content" required placeholder="请输入文章内容" th:text="${article != null ? article.content : ''}"></textarea>
        </div>
        <a href="/echo-network/article-list" class="btn-back">返回列表</a>
        <button type="submit" class="btn-submit">更新文章</button>
    </form>
</div>
</body>
</html>